package com.wf.articleManagement.service.call.impl;

import com.wf.apicommons.entity.articleManagement.ArticleDetails;
import com.wf.apicommons.entity.MessageBoard.MqMessage;
import com.wf.apicommons.entity.userManagement.UserInformation;
import com.wf.apicommons.utils.CodeEnum;
import com.wf.apicommons.utils.CommonResult;
import com.wf.articleManagement.service.call.MessageBoardFeignService;
import com.wf.articleManagement.service.local.BlogRelatedService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

/**
 * @Description: 服务降级处理类
 */
@Slf4j
@Component
public class FeignFallbackServiceImpl  implements  MessageBoardFeignService {

    @Autowired
    @Qualifier("blogRelatedServiceImpl")
    BlogRelatedService brs;



    /**
     * 调用留言管理微服务，推送博客数据，服务降级
     * @param data
     * @return
     */
    @Override
    public CommonResult<String> pushBlogData(MqMessage<ArticleDetails> data) {
        log.info("调用message-board-services服务失败，即将降级刷新本次数据{}",data);
        //手动刷新ES数据
        brs.flushESData(data);
        return CommonResult.success("数据降级刷新成功");
    }

}
